#include <57header.h>

pthread_mutex_t lock;
pthread_cond_t cond;

void *func(void *p){

    pthread_mutex_lock(&lock);
    printf("son1 \n");

    time_t now = time(NULL);
    struct timespec time_out;
    time_out.tv_sec = now + 10;
    time_out.tv_nsec = 0;

    pthread_cond_timedwait(&cond, &lock, &time_out);

    printf("son2 \n");

    pthread_mutex_unlock(&lock);
    return NULL;
}
int main(int argc,char*argv[])
{
    pthread_mutex_init(&lock, NULL);
    pthread_cond_init(&cond, NULL);

    pthread_t son;
    pthread_create(&son, NULL, func, NULL);


    sleep(1);
    pthread_mutex_lock(&lock);
    sleep(20);
    pthread_mutex_unlock(&lock);


    pthread_join(son, NULL);
    return 0;
}

